package xyz.lne.researchgroupmanage.entity.neo4j;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;
import org.springframework.beans.BeanUtils;
import xyz.lne.researchgroupmanage.entity.Keyword;

/**
 * Designed By Lne.
 * 2021/3/2 16:54
 */
@NodeEntity("keyword")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class KeywordNode {
    @Id
    @GeneratedValue
    private Long id;

    @Property(name = "word")
    private String word;

    @Property(name = "keywordId")
    private Integer keywordId;

    public static KeywordNode convertFromKeyword(Keyword keyword){
        KeywordNode keywordNode = new KeywordNode();
        BeanUtils.copyProperties(keyword, keywordNode);
        return keywordNode;
    }
}
